**********************************************
*****  Table 6:  FAIRNESS CONCERNS     *******
**********************************************

use "$dir/Data/analysis_main.dta", clear


eststo clear 

eststo: reghdfe n_productivity post_announce_1_cash post_announce_2_cash post_announce_3p_cash post_announce_1 post_announce_2 post_announce_3p blhrprod blhrprodsq blhrprod_miss bs_labor_30_miss future_fin_worry_miss if pd==1, vce(cl pid) absorb(roundgroup)
 estadd local postpay "N"	
	
eststo: reghdfe n_productivity post_announce_1_cash post_announce_2_cash post_announce_3p_cash post_announce_1 post_announce_2 post_announce_3p cash_postpay blhrprod blhrprodsq blhrprod_miss bs_labor_30_miss future_fin_worry_miss i.pd if pd>0, vce(cl pid) absorb(roundgroup)
 estadd local postpay "Y"	
 
	test post_announce_1_cash = cash_postpay
	qui estadd scalar p_test1=r(p)
	test post_announce_2_cash = cash_postpay
	qui estadd scalar p_test2=r(p)

eststo: reghdfe n_productivity payday_cash payday papc_cash2 payday_cash_wb payday_wb blhrprod blhrprodsq blhrprod_miss bs_labor_30_miss future_fin_worry_miss if pd==1, vce(cl pid) absorb(roundgroup)
	estadd local postpay "N"
 
eststo: reghdfe n_productivity payday_cash payday papc_cash2 payday_cash_wb payday_wb cash_postpay blhrprod blhrprodsq blhrprod_miss bs_labor_30_miss future_fin_worry_miss i.pd if pd>0, vce(cl pid) absorb(roundgroup)
	estadd local postpay "Y"
	lincom cash_postpay - papc_cash2
	estadd scalar pval = 2*ttail(r(df),abs(r(estimate)/r(se)))	
	
label var cash_postpay "Cash $\times$ Post-pay" 	

#delimit ;
local tablerow post_announce_1_cash post_announce_2_cash papc_cash2 payday_cash payday_cash_wb cash_postpay  ;

esttab using "$om/$t/Table_6.tex", 
    b(3) se booktabs star(* .1 ** .05 *** .01) nonotes nomtitles  
    replace label style(tex) gaps keep(`tablerow') order(`tablerow') 
    stats(postpay p_test1 p_test2 pval N, labels("Post-payment period" "P-val: Cash $\times$ Post-pay = Cash $\times$ 1 day post announcement" "P-val: Cash $\times$ Post-pay = Cash $\times$ 2 days post announcement" "P-val: Cash $\times$ Post-pay = Cash $\times$ Announcement"  "N: worker-hours") fmt(%20s %9.3fc %9.3fc %9.3fc %9.0fc)) 
	prehead("{\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \begin{tabular}
	{@{\extracolsep{4pt}}l*{10}{>{\centering\arraybackslash}m{1.8cm}}@{}} 
	\toprule  	
	\multicolumn{1}{l}{}     &\multicolumn{4}{c}{\textbf{Hourly Production}}  \bigstrut    \\
    \cline{2-5} \addlinespace    
	") ;
#delimit cr	
